package com.wanhelibs.custom_view.pop;

import android.app.Activity;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.PopupWindow;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable;
import com.bumptech.glide.request.FutureTarget;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.orhanobut.logger.Logger;
import com.wanhe.base.Const;
import com.wanhe.base.model.disgn.DSFile;
import com.wanhe.base.model.disgn.PageViewModel;
import com.wanhe.base.model.holder.FileHolder;
import com.wanhe.base.util.ObjectUtil;
import com.wanhe.mealbookmodule.adapter.MealBookItemsAdapter;
import com.wanhe.viewconf.views.group.CoordinateViewGroup;
import com.wanhelibs.R;

import java.io.File;
import java.util.concurrent.ExecutionException;

import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * File Name:CoordinatePopupWindow.java<br/>
 * Package Name:com.wanhelibs.custom_view.pop<br/>
 * Date:2017/7/14 9:33<br/>
 * author:chendeji<br/>
 * desc: 弹窗<br/>
 * Copyright (c) 2017/7/14, 781571323@qq.com All Rights Reserved.
 */
public class SetPopupWindow extends PopupWindow {

    public static final String TAG = "SetPopupWindow";

    private final Context mContext;

    public SetPopupWindow(Context context, int width, int height) {
		super(context);
        this.mContext = context;

        setWidth(width);
        setHeight(height);

        View rootView = LayoutInflater.from(context).inflate(R.layout.setmeal_popup_layout, null, true);
		setContentView(rootView);

	}

    /**
     * Methor Name:setAlpha<br/>
     * Package Name:com.wanhelibs.custom_view.pop<br/>
     * Date:2017/7/14 10:33<br/>
     * author:chendeji<br/>
     * desc: <br/>
     * Copyright (c) 2017/7/14, 781571323@qq.com All Rights Reserved.
     *
     * @param alpha 设置背景透明度
     *
     */
    public void setAlpha(float alpha){
        WindowManager.LayoutParams lp = ((Activity)this.mContext).getWindow().getAttributes();
        lp.alpha = alpha; //0.0-1.0
        ((Activity)this.mContext).getWindow().setAttributes(lp);
    }
}
